package com.bzoa.api.control;

import com.bzoa.api.service.UserService;
import com.springboot.common.entity.ResponseResult;
import com.bzoa.api.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author lands
 * @Date 2023/3/6 10:32
 * @Description 不需要登录的控制类，主要为登录，注册，验证码接口
 */
@RestController
@RequestMapping("/")
public class LoginController {
    @Autowired
    private UserService userService;
    /**
     * 登录接口
     * @param user
     * @return
     */
    @PostMapping("login")
    public ResponseResult login(@RequestBody User user) {
        return  userService.login(user.getUsername(),user.getPassword()) ;
    }
    /**
     * 登录接口
     * @param user
     * @return
     */
    @PostMapping("register")
    public ResponseResult register(@RequestBody User user) {
        return  userService.login(user.getUsername(),user.getPassword()) ;
    }

}
